import { IValueNumber, IValueString, IPosition } from '../../types';

type TformatValue<T extends (args: any) => any> = T extends (args: infer P) => any ? P extends string ? IValueString : P extends IValueNumber ? IValueNumber : never : never;
export const formatValue = (val: string|number): IValueNumber|IValueString => {
  if(typeof val === 'number') {
    return {type: 'value', dataType: 'number', value: val}
  } else {

    return {type: 'value', dataType: 'string', value: val}
  }
}
export const formatePosition = (row: number, col: number): IPosition => {
  return {type: 'position', row: row, rowIsRelative: true, col: col, colIsRelative: true};
}
// type TformatValue<T extends (args: any) => any> = T extends (args: infer P) => any ? P extends string ? IValueString : P extends IValueNumber ? IValueNumber : never : never;